package com.mercury.console.controller;

import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

public class AqsExampleDemo {
    private static final Lock lock = new ReentrantLock(true);

    public static void main(String[] args) {

        a();
    }
    public static void a() {
            lock.lock();
            System.out.println("拿到锁");
            b();
            lock.unlock();
    }
    public static void b() {

        lock.lock();
        System.out.println("重入锁");
        lock.unlock();
    }
}